<?php

class Warehouse extends AppModel {
    var $name = 'Warehouse';

    var $belongsTo = array(
        'User' => array(
            'foreignKey' => 'collector_id',
            'fields' => array('name')
        ), 'Province',
    );

    var $hasMany = array(
        'Location'
    );

    var $validate = array(
        'name' => array(
                'notEmpty' => array(
                    'rule' => array('notEmpty'),
                    'message' => 'Warehouse name is required.',
                    'required' => true,
            ),
                'isUnique' => array(
                    'rule' => 'isUnique',
                    'message' => 'This warehouse name is already taken.',
            ),
        ),
    );


}
